<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Converts the timestamp into a string</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.px-timestamp2string" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">px_timestamp2string</h1>
  <p class="verinfo">(PECL paradox &gt;= 1.4.0)</p><p class="refpurpose"><span class="refname">px_timestamp2string</span> &mdash; <span class="dc-title">
   Converts the timestamp into a string
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.px-timestamp2string-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>px_timestamp2string</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$pxdoc</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$value</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$format</code></span>
   ) : <span class="type">string</span></div>


  <p class="para rdfs-comment">
   Turns a timestamp as it stored in the paradox file into human readable
   format. Paradox timestamps are the number of miliseconds since 0001-01-02.
   This function is just for convenience. It can be easily replaced by some
   math and the calendar functions as demonstrated in the following example.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.px-timestamp2string-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">pxdoc</code></dt>

     <dd>

      <p class="para">
       Resource identifier of the paradox database.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">value</code></dt>

     <dd>

      <p class="para">
       Value as stored in paradox database field of type
       PX_FIELD_TIME, or PX_FIELD_TIMESTAMP.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">format</code></dt>

     <dd>

      <p class="para">
        String format similar to the format used by <span class="function"><a href="date.html" class="function">date()</a></span>.
        The placeholders support by this function is a subset of those
        supported by <span class="function"><a href="date.html" class="function">date()</a></span> (Y, y, m, n, d, j, H, h, G, g,
        i, s, A, a, L).
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.px-timestamp2string-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 


 


 <div class="refsect1 examples" id="refsect1-function.px-timestamp2string-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2470">
    <p><strong>Example #1 Turn a paradox timestamp into a human readable form</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$px&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">px_new</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/*&nbsp;make&nbsp;up&nbsp;a&nbsp;date&nbsp;as&nbsp;it&nbsp;could&nbsp;be&nbsp;stored&nbsp;in&nbsp;*/<br />/*&nbsp;a&nbsp;date&nbsp;field&nbsp;of&nbsp;a&nbsp;paradox&nbsp;db.&nbsp;*/<br />/*&nbsp;700000&nbsp;days&nbsp;since&nbsp;1.1.0000.&nbsp;*/<br /></span><span style="color: #0000BB">$days&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">700000</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/*&nbsp;Use&nbsp;the&nbsp;calendar&nbsp;functions&nbsp;to&nbsp;print&nbsp;a&nbsp;*/<br />/*&nbsp;human&nbsp;readable&nbsp;format&nbsp;of&nbsp;the&nbsp;date&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">jdtogregorian</span><span style="color: #007700">(</span><span style="color: #0000BB">$days</span><span style="color: #007700">+</span><span style="color: #0000BB">1721425</span><span style="color: #007700">).</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/*&nbsp;Turn&nbsp;it&nbsp;into&nbsp;a&nbsp;timestamp&nbsp;as&nbsp;it&nbsp;stored&nbsp;in&nbsp;a&nbsp;paradox&nbsp;database&nbsp;*/<br />/*&nbsp;Timestamps&nbsp;are&nbsp;stored&nbsp;in&nbsp;miliseconds&nbsp;since&nbsp;0001-01-02&nbsp;*/<br /></span><span style="color: #0000BB">$stamp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$days&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">86400.0&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">1000.0</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;Add&nbsp;one&nbsp;hour&nbsp;*/<br /></span><span style="color: #0000BB">$stamp&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">3600000.0</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;The&nbsp;following&nbsp;will&nbsp;output&nbsp;'7/15/1917&nbsp;01:00:00'.&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">px_timestamp2string</span><span style="color: #007700">(</span><span style="color: #0000BB">$px</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$stamp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"n/d/Y&nbsp;H:i:s"</span><span style="color: #007700">).</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">px_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$px</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
7/15/1917
7/15/1917 01:00:00
</pre></div>
    </div>
   </div>
  </p>

  <p class="para">
    The Julian day count as passed to <span class="function"><a href="jdtogregorian.html" class="function">jdtogregorian()</a></span>
    has a different base of 1.1.4714 b.c. and must therefore be calculated
    by adding 1721425 to the day count used in the paradox file. Turning the
    day count into a timestamp is easily done by multiplying with 86400000.0
    to obtain miliseconds.
  </p>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.px-timestamp2string-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="px_date2string.html" class="function" rel="rdfs-seeAlso">px_date2string()</a> - Converts a date into a string</span></li>
    <li class="member"><span class="function"><a href="jdtogregorian.html" class="function" rel="rdfs-seeAlso">jdtogregorian()</a> - 转变一个Julian Day计数为Gregorian历法日期</span></li>
   </ul>
  </p>
 </div>



</div></div></div></body></html>